<template>
<section>

  <div class="basic_info">
    <div class="basic_part" >
      <span>车牌号</span>
      <span style="color: #929292;">{{rcarnum}}</span>
    </div>
  </div>

  <div class="basic_info" style="margin-top: .4rem" v-if="result == '查询成功'">
    <div class="basic_part" style="border-bottom: 1px solid #f2f2f2">
      <span>发动机号</span>
      <span>{{engineNumber}}</span>
    </div>
    <div class="basic_part" style="border-bottom: 1px solid #f2f2f2">
      <span style="flex: none;">品牌型号</span>
      <span style="text-align: left;">{{vehicleModelc}}</span>
    </div>
    <div class="basic_part" style="border-bottom: 1px solid #f2f2f2">
      <span>车辆识别代码</span>
      <span>{{vin}}</span>
    </div>
    <div class="basic_part">
      <span>车辆注册日期</span>
      <span>{{registerDate}}</span>
    </div>
  </div>
  <div v-if="result == '查询失败' || code == '1002'">
    <img src="../../assets/sech/no_tip.png" style="width: 4rem;margin-top: .86rem;">
    <p style="margin-top: .3rem;color: #666;">{{result}}</p>
  </div>
</section>
</template>

<script>
    export default {
        name: "carInfoResult",
        data(){
          return{
            rcarnum:'',
            result:'',
            engineNumber:'',//发动机号
            vehicleModelc:'',//品牌型号
            vin:'',//车辆识别代码
            registerDate:'',//注册日期
            code:'',
          }
        },
      created(){
        let obj = JSON.parse(sessionStorage.getItem('TO_OBJECT'));
        this.rcarnum = obj.carnum;

        if(obj.message == '请求成功'){
          if(obj.resultCode == 1001){
            this.engineNumber = obj.engineNumber;
            this.vehicleModelc = obj.vehicleModelc;
            this.vin = obj.vin;
            this.registerDate = obj.registerDate;
            this.result = '查询成功';
          }else{
            this.result = '查询失败';
          }
        }else{
          this.code = obj.code;
          this.result = obj.message;
        }
      }
    }
</script>

<style scoped>
  .basic_info{
    box-shadow: 2px 2px 10px rgba(128,128,128,.2);
    width: 100%;
    padding: 0 .4rem;
  }
  .basic_part{
    display: flex;
    padding: .21rem 0;
    align-items: center;
  }
  .basic_part span:nth-child(1){
    width: 2.4rem;
    text-align: left;
    color:#929292;
    flex: none;
  }
</style>
